// Copyright FYT 邹承甫 2022
#ifndef POST_PROCESSOR__PREDICTOR_HPP_
#define POST_PROCESSOR__PREDICTOR_HPP_

#include <memory>
#include <tuple>

#include <Eigen/Core>

namespace post_processor {

constexpr double GRAVITY_ACC = 9.7803;
constexpr double PI = 3.1415926535;

class Predictor {
 public:
  using Ptr = std::unique_ptr<Predictor>;
  explicit Predictor(const double &air_fraction);
  /**
   * @brief 弹道模型预测
   * @param target_state {x,y,z,vx,vy,vz}
   * @return 俯仰角的补偿，预测后的坐标
   */
  std::tuple<float, Eigen::VectorXd > predict(const Eigen::VectorXd &state);
//  float predict(Eigen::VectorXd &target_state);

  void set_bullet_speed(double bullet_speed);
  void set_air_fraction(double air_fraction);

  [[nodiscard]] inline bool ok() const { return is_ok_; }

 private:
  bool calcBulletModel(const double &distance, const double &angle,
                       double &height_predict, double &flying_time) const;
  double air_fraction_;
  bool is_ok_;
  double bullet_speed_;
};

}  // namespace post_processor
#endif  // POST_PROCESSOR__PREDICTOR_HPP_